#!/bin/bash
#chkconfig:2345 80 90
#description:auto_adjtimex

MUTE=0

start(){ 
	if [ "${MUTE}" -eq "0" ]; then
		echo "adjtimex is start"
		MUTE=1
		sh /etc/adjtime.sh
	else
		echo "adjtimex has been started"
	fi
}

stop(){
	if [ "${MUTE}" -eq "1" ]; then
		echo "adjtimex is start"
		NUTE=0
		kill -9 `ps -ef|grep "adjtime.sh"|grep -v "grep"|awk '{print $2}'`
	else
		echo "adjtimex has been stopped"
	fi
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	restart)
		stop
		start
		;;
	*)
        echo $"Usage: $0 {start|stop||restart}"
        exit 2
esac
